import numpy as np
np.seterr(divide='ignore',invalid='ignore')
def Fit(Zheng,input):
    for i in Zheng.Style:
        for j in input:
            if i==j:
                Zheng.dictory[i]=1
                break
    dataPct = np.mat([1]*len(Zheng.Style))
    dataReal = np.mat([Zheng.dictory[key] for key in Zheng.dictory])
    Zheng.fit = Cosine(dataPct,dataReal)
def Cosine(dataA,dataB):
    sumData = dataA*dataB.T
    denom = np.linalg.norm(dataA)*np.linalg.norm(dataB)
    return 0.5+0.5*(sumData/denom)
class QiXu:
    Style=["疲乏","气短","自汗","语音低弱","气短懒言","容易疲乏","精神不振","易出汗","舌淡红"]
    dictory=dict(zip(Style,[0]*len(Style)))
    type="气虚证"
    ill="易患感冒、内脏下垂等病；病后康复缓慢"
    fit=0
class YangXu:
    Style = ["畏冷","手足不温","喜热饮食","精神不振","舌淡胖嫩","脉沉迟"]
    dictory = dict(zip(Style,[0]*len(Style)))
    type="阳虚证"
    ill="易患痰饮、肿胀、泄泻等病；感邪易从寒化。"
    fit=0
class YinXu:
    Style = ["手足心热","口燥咽干","鼻微干","喜冷饮","大便干燥","舌红少津","脉细数"]
    dictory = dict(zip(Style,[0]*len(Style)))
    type="阴虚证"
    ill="易患虚劳、失精、不寐等病；感邪易从热化。"
    fit=0
class TanShi:
    Style = ["皮肤油脂较多","多汗且黏","胸闷","痰多","口黏腻","苔腻","脉滑"]
    dictory = dict(zip(Style,[0]*len(Style)))
    type="痰湿证"
    ill="易患消渴、中风、胸痹等病。"
    fit=0
class ShiRe:
    Style = ["面垢油光","易生痤疮","口苦","口干","身重困倦","大便黏滞","小便短黄","舌偏红","苔黄腻","脉滑数"]
    dictory = dict(zip(Style,[0]*len(Style)))
    type="湿热证"
    ill="易患疮疖、黄疸、热淋等病。"
    fit=0
arr = [QiXu,YangXu,YinXu,TanShi,ShiRe]